-
Notifications
You must be signed in to change notification settings - Fork 29.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
util: improve isInsideNodeModules #52147
Conversation
d08b72a
to
0778337
Compare
Just curious, did you do that for performance reasons, or is that a neutral change to make the regex more intention-revealing? |
I just saw that the capturing group is not used and the captured string can be very long. So i had performance in mind, but i didnt wanted to claim a (significant?) performance gain, which i probably cant prove. |
Looks like this a breaking the following tests:
|
I will have a look at it in few hours ;) |
0778337
to
c714cda
Compare
Should be fixed now. |
@nodejs/node-core-utils can this be merged? |
if (RegExpPrototypeExec(/^\/|\\/, filename) === null) | ||
if ( | ||
filename[0] !== '/' && | ||
StringPrototypeIncludes(filename, '\\') === false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This only applies to Windows right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this PR is already old but afaik it was effecting linux too
Commit Queue failed- Loading data for nodejs/node/pull/52147 ✔ Done loading data for nodejs/node/pull/52147 ----------------------------------- PR info ------------------------------------ Title util: improve isInsideNodeModules (#52147) Author Aras Abbasi (@Uzlopak) Branch Uzlopak:util-isInsideNodeModules -> nodejs:main Labels util, author ready, needs-ci Commits 1 - util: improve isInsideNodeModules Committers 1 - uzlopak PR-URL: https://github.com/nodejs/node/pull/52147 Reviewed-By: Antoine du Hamel Reviewed-By: Ruben Bridgewater Reviewed-By: Luigi Pinca ------------------------------ Generated metadata ------------------------------ PR-URL: https://github.com/nodejs/node/pull/52147 Reviewed-By: Antoine du Hamel Reviewed-By: Ruben Bridgewater Reviewed-By: Luigi Pinca -------------------------------------------------------------------------------- ℹ This PR was created on Mon, 18 Mar 2024 20:58:36 GMT ✔ Approvals: 3 ✔ - Antoine du Hamel (@aduh95) (TSC): https://github.com/nodejs/node/pull/52147#pullrequestreview-1950310069 ✔ - Ruben Bridgewater (@BridgeAR) (TSC): https://github.com/nodejs/node/pull/52147#pullrequestreview-1951180547 ✔ - Luigi Pinca (@lpinca): https://github.com/nodejs/node/pull/52147#pullrequestreview-1953430893 ✘ Last GitHub CI failed ℹ Last Full PR CI on 2024-05-05T08:45:43Z: https://ci.nodejs.org/job/node-test-pull-request/58945/ - Querying data for job/node-test-pull-request/58945/ ✔ Last Jenkins CI successful -------------------------------------------------------------------------------- ✔ Aborted `git node land` session in /home/runner/work/node/node/.ncuhttps://github.com/nodejs/node/actions/runs/8957320660 |
PR-URL: nodejs#52147 Reviewed-By: Antoine du Hamel <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
f02a1ba
to
b77f32b
Compare
PR-URL: nodejs#52147 Reviewed-By: Antoine du Hamel <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
PR-URL: #52147 Reviewed-By: Antoine du Hamel <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
PR-URL: #52147 Reviewed-By: Antoine du Hamel <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
PR-URL: nodejs#52147 Reviewed-By: Antoine du Hamel <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
PR-URL: nodejs#52147 Reviewed-By: Antoine du Hamel <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
Improve isInsideNodeModules by avoiding a Regex
kNodeModulesRE is using a non-capturing group